package com.github.sbb.sherry.console.service;

import com.github.sbb.sherry.repository.WelcomeQuoteRepository;
import com.github.sbb.sherry.repository.entity.WelcomeQuote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WelcomeQuoteService {

  @Autowired
  private WelcomeQuoteRepository welcomeQuoteRepository;

  public WelcomeQuote random() {
    WelcomeQuote quote = welcomeQuoteRepository.random();
    if (quote == null) {
      quote = new WelcomeQuote();
      quote.setEnglish("A friend is one of the nicest things you can have, and one of the best things you can be.");
    }
    return quote;
  }
}
